﻿using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{
    /// <summary>
    /// 数据库上下文类
    /// </summary>
    public class DecorationDbContext : DbContext
    {
        public DecorationDbContext()
        {
        }

        public DecorationDbContext(DbContextOptions<DecorationDbContext> options) : base(options)
        {
        }


        //数据集
        public DbSet<UserInfo> UserInfo { get; set; }
        public DbSet<RoleInfo> RoleInfo { get; set; }
        public DbSet<UserInfoRoleInfo> UserInfoRoleInfo { get; set; }
        public DbSet<MenuInfo> MenuInfo { get; set; }
        public DbSet<RoleInfoMenuInfo> RoleInfoMenuInfo { get; set; }
        public DbSet<Classification> Classification { get; set; }
        public DbSet<Notice> Notice { get; set; }
        public DbSet<Material> Material { get; set; }
        public DbSet<Order> Order { get; set; }
        public DbSet<OrderMaterial> OrderMaterial { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=HomeDecoration;User ID=sa;Password=123;Trust Server Certificate=True");
            //optionsBuilder.LogTo(Console.WriteLine, LogLevel.Information);
        }
    }
}
